import java.util.Scanner;
public class MenuDrivenProgram{
   public static void main(String[] args){
      Scanner kbscanner = new Scanner(System.in);
      int num1= 0, num2= 0, result, choice;
      
      do{
         System.out.println("1. Addition");
         System.out.println("2. Subtraction");
         System.out.println("3. Multiplication");
         System.out.println("4. Exit");
         
         System.out.println("Please select your choice: ");
         choice = kbscanner.nextInt();
         
         switch(choice){
            case 1:
            case 2:
            case 3: System.out.println("Enter two integers: ");
                    num1 = kbscanner.nextInt();
                    num2 = kbscanner.nextInt();
          }
          
          switch(choice){
            case 1: System.out.println(num1 + " + " + num2 + " = " + (num1 + num2));
                    break;
            case 2: System.out.println(num1 + " - " + num2 + " = " + (num1 - num2));
                    break;
            case 3: System.out.println(num1 + " * " + num2 + " = " + (num1 * num2));
                    break;
            case 4: break;
            default: System.out.println("Error: Invalid choice");
          }
           
           kbscanner.nextLine();  // remove \n from input buffer
           if(choice != 4){
             System.out.println("Press Enter key to continue . . .");
             kbscanner.nextLine();  
           }       
                    
      }while(choice != 4);
   }
}